import {fetch} from '@/utils/fetch'

export const createMaterial = async ({ type, key, size, meta = {} }) => {
  let res = await fetch({
    query: `
      mutation($meta: JSON) {
        createMaterial(material: {
          type: "${type}",
          key: "${key}",
          size: ${size},
          meta: $meta
        }) {
          id
          type
          size
          key
          meta
        }
      }
    `,
    variables: {
      meta
    }
  })
  return res.data.createMaterial
}
